<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>后台管理系统主页</title>
<link rel="stylesheet" type="text/css" href="${ctx}/resources/plugins/jquery-easyui-1.4.3/themes/IconExtension.css">
<link rel="stylesheet" type="text/css" href="${ctx}/resources/plugins/jquery-easyui-1.4.3/themes/metro/easyui.css">
<%-- <link rel="stylesheet" type="text/css" href="${ctx}/resources/plugins/jquery-easyui-1.4.3/themes/default/easyui.css"> --%>
<%-- <link rel="stylesheet" type="text/css" href="${ctx}/resources/plugins/jquery-easyui-1.4.3/themes/metro/easyui.css"> --%>
<link rel="stylesheet" type="text/css" href="${ctx}/resources/plugins/jquery-easyui-1.4.3/themes/icon.css">
<script type="text/javascript" src="${ctx}/resources/plugins/jquery-easyui-1.4.3/jquery.min.js"></script>
<script type="text/javascript" src="${ctx}/resources/plugins/jquery-easyui-1.4.3/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${ctx}/resources/plugins/jquery-easyui-1.4.3/locale/easyui-lang-zh_CN.js"></script>

<script type="text/javascript" src="${ctx}/resources/js/validate.js"></script>

<script type="text/javascript">
	var url;
	
	function openTab(text,url,iconCls){
		if($("#tabs").tabs("exists",text)){
		   $("#tabs").tabs("select",text);
		}else{
			var content="<iframe frameborder=0 scrolling='auto' style='width:100%;height:100%' src='${ctx}/view/"+url+"'></iframe>";
			$("#tabs").tabs("add",{
				title:text,
				iconCls:iconCls,
				closable:true,
				content:content
			});
		}
	}
	
	function openTabBackGround(text,url,iconCls){
		if($("#tabs").tabs("exists",text)){
// 			var content="<iframe frameborder=0 scrolling='auto' style='width:100%;height:100%' src='${ctx}/"+url+"'></iframe>";
// 			var tab = $('#tabs').tabs('getTab' , text);  // get selected panel
// 			$('#tabs').tabs('update', {
// 				tab: tab,
// 				options: {
// 					title:text,
// 					iconCls:iconCls,
// 					closable:true,
// 					content:content
// 				}
// 			});
			 $("#tabs").tabs("close",text);
			  var content="<iframe frameborder=0 scrolling='auto' style='width:100%;height:100%' src='"+url+"'></iframe>";
				$("#tabs").tabs("add",{
					title:text,
					iconCls:iconCls,
					closable:true,
					content:content
				});
				//${ctx}/
		}else{
			var content="<iframe frameborder=0 scrolling='auto' style='width:100%;height:100%' src='"+url+"'></iframe>";
			$("#tabs").tabs("add",{
				title:text,
				iconCls:iconCls,
				closable:true,
				content:content
			});
		}
	}
	
	
	
	
 formatterDate = function(date) {
	 var day = date.getDate() > 9 ? date.getDate() : "0" + date.getDate();
	 var month = (date.getMonth() + 1) > 9 ? (date.getMonth() + 1) : "0"+ (date.getMonth() + 1); 
	 return date.getFullYear() + '-' + month + '-' + day; };  
	 window.onload = function () {
		 $('#startTime').datebox('setValue', formatterDate(new Date()));
		 }  

	function openPasswordModifyDialog(){
		$("#dlg").dialog("open").dialog("setTitle","修改密码");
		url="${ctx}/user/changePwd.do?id=${user.id}";
	}
	
	function closePasswordModifyDialog(){
		$("#dlg").dialog("close");
		$("#password").textbox("clear");
		$("#newPwd").textbox("clear");
		$("#newPwd2").textbox("clear");
	}
	
	//修改密码
	function modifyPassword(){
		$("#fm").form("submit",{
			url:url,
			onSubmit:function(){
				if(!$(this).form("validate")){
					return false;
				}
				return true;
			},
			success:function(result){
				if(res.code == '0000'){
					$.messager.alert("系统提示","密码修改成功,下一次登录生效","info",function(){
						closePasswordModifyDialog();
					});
				}else{
					$.messager.alert("系统提示",res.msg ,"info",function(){
						//closePasswordModifyDialog();
					});
					return;
				}
			}
		});
	}
	
	//注销登录
	function logout(){
		$.messager.confirm("系统提示","您确定要退出系统吗",function(r){
			if(r){
				window.location.href="${ctx}/sys/authen/logout.do";
			}
		});
	}
	

</script>
</head>
<body class="easyui-layout">
<div region="north" style="height: 78px;background-color: #E0ECFF">
	<table style="padding: 5px" width="100%">
		<tr>
			<td width="50%">
<%-- 				<img src="${ctx}/resources/images/bglogo.png"/> --%>
                  LPHome 后台管理系统
			</td>
			<td valign="bottom" align="right" width="50%">
				<font size="3">&nbsp;&nbsp;<strong>欢迎您：${username}</strong></font>
			</td>
		</tr>
	</table>
</div>
<div region="center">
	<div class="easyui-tabs" fit="true" border="false" id="tabs">
		<div title="首页" data-options="iconCls:'icon-home'">
			<div align="center" style="padding-top: 100px"><font color="red" size="10">欢迎使用</font></div>
		</div>
	</div>
</div>
<div region="west" style="width: 200px" title="物流系统" split="true">
	<div class="easyui-accordion" data-options="fit:true,border:false">
		
	    <div title="用户管理"  data-options="iconCls:'icon-folder'" style="padding:10px;">
			<a href="javascript:openTab('设计师管理', 'customerManage.jsp','icon-user')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-user'" style="width: 100px;">设计师管理</a>
 			<a href="javascript:openTab('品牌管理','brandManage.jsp','icon-user')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-user'" style="width: 100px;">品牌管理</a>
			<a href="javascript:openTab('类别管理', 'categoryManage.jsp','icon-user')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-user'" style="width: 100px;">类别管理</a>
			<a href="javascript:openTab('户型管理', 'housemodelManage.jsp','icon-user')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-user'" style="width: 100px;">户型管理</a>
			<a href="javascript:openTab('样板房管理','samplehouseManage.jsp','icon-user')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-user'" style="width: 100px;">样板房管理</a>
			<a href="javascript:openTab('模型管理','modelManage.jsp','icon-user')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-user'" style="width: 100px;">模型管理</a>
			<a href="javascript:openTab('商品清单','billgoodsManage.jsp','icon-user')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-user'" style="width: 100px;">商品清单</a>
		</div>
		 
		<div title="系统管理"  data-options="iconCls:'icon-item'" style="padding:10px">
<!-- 		<a href="javascript:openTab('角色管理','roleManage.jsp','icon-user')" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-modifyPassword'" style="width: 150px;">角色管理</a> -->
<!-- 		<a href="javascript:openPasswordModifyDialog()" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-modifyPassword'" style="width: 150px;">权限管理</a> -->
		<a href="javascript:openPasswordModifyDialog()" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-modifyPassword'" style="width: 150px;">修改密码</a>
		<a href="javascript:logout()" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-exit'" style="width: 150px;">安全退出</a>
	</div>
</div>
<div region="south" style="height: 25px;padding: 5px;" align="center">
  <a href="http://www.qingz.com.cn" target="_blank">成都橙锦信息技术有限公司  </a> Copyright @ 2012-2015 Enniu.All Rights Reserved   蜀ICP备14023001号
</div>


<!-- 修改密码对话框  -->
<div id="dlg" class="easyui-dialog" style="width: 400px;height:250px;padding: 10px 20px"
  closed="true" buttons="#dlg-buttons">
 	<form id="fm" method="post">
 		<table cellspacing="8px">
 			<tr>
 				<td>用户名：</td>
 				<td><input type="text" id="userName" name="userName" class="easyui-textbox" value="${user.username}" readonly="readonly" style="width: 200px"/></td>
 			</tr>
 			<tr>
 				<td>原密码：</td>
 				<td><input type="password" id="password" name="password" class="easyui-textbox easyui-validatebox" required="true" style="width: 200px"/></td>
 			</tr>
 			<tr>
 				<td>新密码：</td>
 				<td><input type="password" id="newPwd" name="newPwd" class="easyui-textbox easyui-validatebox" required="true" style="width: 200px"/></td>
 			</tr>
 			<tr>
 				<td>确认新密码：</td>
 				<td><input type="password" id="newPwd2"  name="newPwd2" class="easyui-textbox easyui-validatebox" required="true"  validType="equalTo['#newPwd']"  invalidMessage="两次输入密码不匹配" style="width: 200px"/></td>
 			</tr>
 		</table>
 	</form>
</div>


<div id="dlg-buttons">
	<a href="javascript:modifyPassword()" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
	<a href="javascript:closePasswordModifyDialog()" class="easyui-linkbutton" iconCls="icon-cancel">关闭</a>
</div>

</body>
</html>